$(document).ready(function(){
	
	$(".donebutton").click(function(){
		// Display the spinning gif
		
		// Get the annotation
		annotation = $('input[name|="textbox'+$(this).attr("name")+'"]').val();
		
		if(annotation==""){
			return;
		} else {
			$(this).attr("disabled","disabled");
		}
		
		// Send the information back
		$.ajax({
			type: "POST",
			url: "annotate",
			data: { name: $(this).attr('name'), annotation:annotation}
		}).success(function(){
			alert("load new image and update the statistics");
		}).error(function(){
			alert("display the error");
		});
	})
});
